<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/mui.css"/>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../../css/general.css"/>
		<style type="text/css">
			
			.ctext{
				position: absolute;
				top: 50%;
				right: 10px;
			    -webkit-transform: translateY(-50%);
			    transform: translateY(-50%);
			    background-color: white;
			    padding: 0.3em;
			}
			.ctext>img{
				width: 30px;
				height: 30px;
			}
			.addposcss{
				width: 100%;
				text-align: center;
				margin-top: 20%;
				color: #7c7c7c;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav hbg">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left colorw"></a>
		    <h1 class="mui-title">员工岗位列表</h1>
		</header>
		<div class="mui-content">
		    
		    <div class="main" id="poslist">
		    	<!--
                	作者：592176224@qq.com
                	时间：2019-01-14
                	描述：
              
		    	<ul class="mui-table-view">
		            <li class="mui-table-view-cell">
		                <a class="mui-navigate-right">
		                    发型师
		                </a>
		                <div class="ctext" >
		                	<img src="../../img/del.png"/>
		                </div>
		            </li>
		        </ul>
		          -->
		    </div>
		    
		    
		    
		</div>
		<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/req.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var type; 
			window.onload = function(){
				mui.init();
				type = getrequest().type;
				console.log(type);
				mui.plusReady(function(res){
					 var view = plus.webview.currentWebview();
					 type = view.type;
				})
				getrolelist();
				
				
			}
			function getrolelist(){
				var data = {
					url:"/api/role/lst",
					data:{access_token:acctoken()}
				}
				ajax(data,function(res){
					console.log("角色列表",res)
					setrolelist(res.data.data);
				})
			}
			function setrolelist(list){
				var str= '';
				if(list.length>0){
					str = '<ul class="mui-table-view">';
					for (var i = 0; i < list.length; i++) {
						str += '<li class="mui-table-view-cell" onclick="gocomset('+list[i].id+')"><a class="mui-navigate-right">'+
			                    list[i].role_name+
			                '</a></li>';
					}
					str +='</ul>';
						
				}else{
					str = '<div class="addposcss">请添加职位</div>'
				}
				g("poslist").innerHTML = str;
				
			}
			
			function gocomset(rid){
				var list = {rid: rid},
				url = "",
				id = "";
				if(type == "cz"){
					console.log("充值");
					url = 'commission-set.html?rid='+rid;
					id = 'commission-set';
				}else if(type == "yj"){
					console.log("业绩");
					url = 'results-set.html?rid='+rid;
					id = 'results-set';
				}else if(type == "xs"){
					console.log("销售");
					url = '../employees/selectproject.html?rid='+rid;
					id = 'selectproject';
				}
				//return;
				mui.openWindow({
				    url: url,
				    id: id,
				    extras: list,
				 });
			}
		</script>
	</body>

</html>